<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>Happy ERP</title>
    <%= stylesheet_link_tag "../javascripts/ext/resources/css/ext-all.css" %>
    <%= stylesheet_link_tag "/stylesheets/tasks.css" %>

    <%= javascript_include_tag "ext/adapter/ext/ext-base.js" %>
    <%= javascript_include_tag "ext/ext-all.js" %>
    <%= javascript_include_tag "ext/src/locale/ext-lang-zh_CN.js" %>
  </head>
  <body>
    <script type="text/javascript">
      Ext.onReady(function(){
        var comboxWithTree = new Ext.form.ComboBox({
          store:new Ext.data.SimpleStore({fields:[],data:[[]]}),
          editable:false,
          shadow:false,
          mode: 'local',
          triggerAction:'all',
          maxHeight: 200,
          tpl: '<tpl for="."><div style="height:200px"><div id="tree1"></div></div></tpl>',
          selectedClass:'',
          onSelect:Ext.emptyFn
        });
        var tree1 = new Ext.tree.TreePanel({
          //loader: new Ext.tree.TreeLoader({dataUrl:'/product/getTreeData'}),
          loader: new Ext.tree.TreeLoader({
            dataUrl:'/product/getTreeData'
          }),
          border:false,
          root: new Ext.tree.AsyncTreeNode({
            id:0,
            text:'Products'
          })
        });
        //tree1.on('click',function(node){
          //comboxWithTree.setValue(node.text);
          //comboxWithTree.collapse();
        //});
        tree1.on('dblclick',function(node){
          alert("OK");
        });

        comboxWithTree.on('expand',function(){
          tree1.render('tree1');
        });
        comboxWithTree.render('comboxWithTree');
      });
    </script>
    <div id="comboxWithTree"></div>
  </body>
</html>
